import Vue from 'vue'
import Vuex from 'vuex'
import persistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    userInfo: null,
    ticket: ''
  },
  mutations: {
    SET_USERINFO(state, user) {
      state.userInfo = user
    },
    SET_TICKET(state, ticket) {
      state.ticket = ticket
    }
  },
  getters: {
    userInfo: state => state.userInfo,
    ticket: state => state.ticket
  },
  plugins: [persistedState()]
})

export default store
